package daily.kou2022_0107;



public class Num53 {
    //53. 最大子数组和
    public static int maxSubArray(int[] nums) {
        int max=nums[0];
        int cur=max;
        int length=nums.length;
        for (int i = 1; i <length ; i++) {
            cur=Math.max(0,cur)+nums[i];
            max=Math.max(max,cur);
        }
        return max;

    }


}
